Attribute VB_Name = "basLog"
'*---------------------------------------------------------------
'*
'* ModuleName:     basLog
'* FileName:       LOG.BAS
'* Date:           July 1998
'* Author:         Richard D. Knowles
'* Company:        Mindkey Software Solutions (Pty) Ltd.
'* Copyright:      Copyright (C) 1998 by Mindkey Software Solutions
'*                 All Rights Reserved
'* Description:    Write to a log file, location of which is in the registry.
'*---------------------------------------------------------------

Option Explicit

Public Function LogEvent(strErrorMessage As String)
                          
  Dim strLogFolder, strLogFile As String
  Dim objOptions As New clsOptions
  
  'Get log folder from registry, else use current
  strLogFolder = objOptions.LogFolder
  If strLogFolder = "" Or strLogFolder = " " Then
    strLogFolder = CurDir
  End If
  
  'If folder doesn't exist, use current.
  If Dir(strLogFolder, vbDirectory) = "" Then
    strLogFolder = CurDir
  End If
  
  'Build log filename
  strLogFile = Format(Now, "yyyymmdd") & ".LOG"
  
  'Write to the file, creating it if it doesn't exist
  Open strLogFolder & "\" & strLogFile For Append Access Write As #1
  If strErrorMessage <> "" Then
    Print #1, Format(Now, "hh:nn:ss"); ": "; strErrorMessage
  End If
  Close #1
  
End Function
